/*
 * CircularQueue.h
 *
 *  Created on: 2 mars 2011
 *      Author: eric
 */

#ifndef CIRCULARQUEUE_H_
#define CIRCULARQUEUE_H_

#include <Arduino.h>

#include "Can.h"

class CircularQueue {
	typedef struct {
		Can::CAN_MSG canBuf[16];
		uint8_t size;
		//  uint8_t head, tail;
		uint8_t length;
		uint8_t head;
		//  uint8_t tail = (head + length - 1) % size
	} queue_t;
	queue_t q;
public:
	CircularQueue();
	void push(Can::CAN_MSG canMsg);
	uint8_t count();
	bool isEmpty();
	bool isFull();
	Can::CAN_MSG pop();
	Can::CAN_MSG peek();
};
#endif /* CIRCULARQUEUE_H_ */
